/**
 * 
 */
package com.disys.common;

import java.math.BigInteger;
import java.util.Calendar;
import java.util.Date;

/**
 * @author Ubaid Raja
 *
 */
public class Util {

	public static Integer getWeekNumber(){
		Date date = new Date();
		Calendar cal = Calendar.getInstance();
		// date = dateFormat.format(date);
		cal.setTime(date);
		Integer week = cal.get(Calendar.WEEK_OF_YEAR);
		System.out.println("Current week number is : " + week);
		return week;
	}
	
	public static Date getLastWeekDay() {
		Calendar c = Calendar.getInstance();
		//System.out.println(c.get(Calendar.DAY_OF_WEEK));
		//System.out.println(new Date(c.getTimeInMillis()));
		c.set(Calendar.DAY_OF_WEEK, 7);
		//System.out.println(c.get(Calendar.DAY_OF_WEEK));
		//System.out.println(new Date(c.getTimeInMillis()));
		return new Date(c.getTimeInMillis());
	}
	
	public static Date getFirstWeekDay() {
		Calendar c = Calendar.getInstance();
		c.set(Calendar.DAY_OF_WEEK, 1);
		return new Date(c.getTimeInMillis());
	}
	
	public static BigInteger getBigInteger(Integer processId){
		BigInteger proId = BigInteger.valueOf(processId);
		return proId;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		getBigInteger(10);
		Date firstDate = getFirstWeekDay();
		System.out.println(firstDate);
		
		Date d = getLastWeekDay();
		System.out.println(d);
	}

}
